package com.example.translateappjava.Service.ForumApiService;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import com.google.gson.Gson; // For GsonBuilder if needed
import com.google.gson.GsonBuilder; // For GsonBuilder if needed

public class ApiClient {
    // Correct BASE_URL for your API
    public static final String BASE_URL = "http://47.120.15.23:6001/";

    private static Retrofit retrofit = null;

    public static Retrofit getClient() {
        if (retrofit == null) {
            // Optional: If you need to configure Gson (e.g., date formats, null serialization)
            // Gson gson = new GsonBuilder()
            // .setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ") // Example date format
            // .serializeNulls() // To include null fields in JSON
            // .create();

            retrofit = new Retrofit.Builder()
                    .baseUrl(BASE_URL)
                    .addConverterFactory(GsonConverterFactory.create()) // Uses default Gson
                    // .addConverterFactory(GsonConverterFactory.create(gson)) // If using custom Gson
                    .build();
        }
        return retrofit;
    }
}